import {ref, onMounted} from 'vue'
import { defineStore } from 'pinia'
import {getCategoryAndGoodsAPI} from "@/apis/layout.js";

export const useCategoryStore = defineStore('categoryAndGoods', () => {
  const categoryAndGoodsList = ref([])
  const getCategoryAndGoods = async () => {
    const res = await getCategoryAndGoodsAPI();
    categoryAndGoodsList.value = res.data;
    console.log("store",res)
  }
  onMounted(() => getCategoryAndGoods())
  return { categoryAndGoodsList, getCategoryAndGoods }
})
